// 1002.cpp : Defines the entry point for the console application.
//
#include <iostream>
using namespace std;

#define MAX_BUF_LENGTH 1000000

struct N
{
	int prev;
	int length;
	N()
	{
		prev = 0;
		length = 0;
	}
};
N* F = NULL;

int G( long long m, bool* p )
{
	if( m >= MAX_BUF_LENGTH ) return 0;

	if( F[m].prev == m ) return F[m].length;
	if( F[m].prev != 0 ) return F[F[m].prev].length + F[m].length;

	long long n = m;
	int c = 1;
	while( n != 1 )
	{
		if( n & 0x01 )
		{
			n = n + (n << 1) + 1;
		}
		else
		{
			n >>= 1;
		}

		if( n < MAX_BUF_LENGTH )
		{
			F[n].length = -c;
			F[n].prev = m;
			p[n] = false;
		}
		c++;
	}
	F[m].length = c;
	F[m].prev = m;
	return c;
}

int main(int argc, char* argv[])
{
	F = new N[ MAX_BUF_LENGTH ];

	int a = 0;
	int b = 0;
	while( cin >> a >> b )
	{
		cout << a << " " << b << " ";

		if( a > b )
		{
			std::swap( a, b );
		}

		bool P[ MAX_BUF_LENGTH ] = { false };
		int max = 0;
		for( int k = a; k <= b; k++ )
		{
			if( P[k] ) continue;
			int n = G( k, P );
			if( max < n ) max = n;
		}
		cout << max << endl;
	}

	delete[] F;
	return 0;
}

